package com.yq.day74.danli.v2;



/**
 * @author 3307235355@qq.com
 * @description
 * @since 2022/07/04 15:05
 */
public class SingletonTest {
    public static void main(String[] args) {
        //线程安全
        // Singleton1 instance1 = Singleton1.getInstance();
        // System.out.println(instance1);
        // Singleton1 instance2 = Singleton1.getInstance();
        // System.out.println(instance2);

        new Thread(()->{
            Singleton2 instance1 = Singleton2.getInstance();
            System.out.println(instance1);
        }).start();


        new Thread(()->{
            Singleton2 instance2 = Singleton2.getInstance();
            System.out.println(instance2);
        }).start();




    }
}
